package com.bwie.learn;

public class TestDemo1 {
	public static void main(String[] args) {
		//以下是通过String的常量池创建的
		String a = "ma xiao shuai";
		String b = "ma xiao shuai";
		//以下是通过new出来的
		String c = new String("ma xiao shuai");
		String d = new String("ma xiao shuai");
		System.out.println("a==b:"+(a==b));
		System.out.println("a==c:"+(a==c));
		System.out.println("c==d:"+(c==d));
		//equals判断标准是以String对象指代“内容”为准
		//“==”地址符为准，如果是true说明指向的是同一个对象
		System.out.println("a和b用equals比较:"+(a.equals(b)));
		System.out.println("c和d用equals比较:"+(c.equals(d)));
		System.out.println("a和d用equals比较:"+(a.equals(d)));
	}
}
